--=========================================================
--客户数据
--=========================================================
--华东物流
CREATE TABLE [dbo].[t_jiuqi_customer_hdwl](
	[code] [varchar](100) COLLATE Chinese_PRC_CI_AS NULL,
	[name] [varchar](100) COLLATE Chinese_PRC_CI_AS NULL,
	[mnemonic_code] [varchar](100) COLLATE Chinese_PRC_CI_AS NULL,
	[company_id] [int] NULL
);
--朱家桥
CREATE TABLE [dbo].[t_jiuqi_customer_zjq](
	[code] [varchar](100) COLLATE Chinese_PRC_CI_AS NULL,
	[name] [varchar](100) COLLATE Chinese_PRC_CI_AS NULL,
	[mnemonic_code] [varchar](100) COLLATE Chinese_PRC_CI_AS NULL,
	[company_id] [int] NULL
);
--上海
CREATE TABLE [dbo].[t_jiuqi_customer_sh](
	[code] [varchar](100) COLLATE Chinese_PRC_CI_AS NULL,
	[name] [varchar](100) COLLATE Chinese_PRC_CI_AS NULL,
	[mnemonic_code] [varchar](100) COLLATE Chinese_PRC_CI_AS NULL,
	[company_id] [int] NULL
);
--仓储
CREATE TABLE [dbo].[t_jiuqi_customer_cc](
	[code] [varchar](100) COLLATE Chinese_PRC_CI_AS NULL,
	[name] [varchar](100) COLLATE Chinese_PRC_CI_AS NULL,
	[mnemonic_code] [varchar](100) COLLATE Chinese_PRC_CI_AS NULL,
	[company_id] [int] NULL
);
--广州
CREATE TABLE [dbo].[t_jiuqi_customer_gz](
	[code] [varchar](100) COLLATE Chinese_PRC_CI_AS NULL,
	[name] [varchar](100) COLLATE Chinese_PRC_CI_AS NULL,
	[mnemonic_code] [varchar](100) COLLATE Chinese_PRC_CI_AS NULL,
	[company_id] [int] NULL
);
--杭州
CREATE TABLE [dbo].[t_jiuqi_customer_hz](
	[code] [varchar](100) COLLATE Chinese_PRC_CI_AS NULL,
	[name] [varchar](100) COLLATE Chinese_PRC_CI_AS NULL,
	[mnemonic_code] [varchar](100) COLLATE Chinese_PRC_CI_AS NULL,
	[company_id] [int] NULL
);
--合肥
CREATE TABLE [dbo].[t_jiuqi_customer_hf](
	[code] [varchar](100) COLLATE Chinese_PRC_CI_AS NULL,
	[name] [varchar](100) COLLATE Chinese_PRC_CI_AS NULL,
	[mnemonic_code] [varchar](100) COLLATE Chinese_PRC_CI_AS NULL,
	[company_id] [int] NULL
);
--江苏
CREATE TABLE [dbo].[t_jiuqi_customer_js](
	[code] [varchar](100) COLLATE Chinese_PRC_CI_AS NULL,
	[name] [varchar](100) COLLATE Chinese_PRC_CI_AS NULL,
	[mnemonic_code] [varchar](100) COLLATE Chinese_PRC_CI_AS NULL,
	[company_id] [int] NULL
);
--昆明
CREATE TABLE [dbo].[t_jiuqi_customer_km](
	[code] [varchar](100) COLLATE Chinese_PRC_CI_AS NULL,
	[name] [varchar](100) COLLATE Chinese_PRC_CI_AS NULL,
	[mnemonic_code] [varchar](100) COLLATE Chinese_PRC_CI_AS NULL,
	[company_id] [int] NULL
);
--联运(芜湖)
CREATE TABLE [dbo].[t_jiuqi_customer_lywh](
	[code] [varchar](100) COLLATE Chinese_PRC_CI_AS NULL,
	[name] [varchar](100) COLLATE Chinese_PRC_CI_AS NULL,
	[mnemonic_code] [varchar](100) COLLATE Chinese_PRC_CI_AS NULL,
	[company_id] [int] NULL
);
--联运
CREATE TABLE [dbo].[t_jiuqi_customer_ly](
	[code] [varchar](100) COLLATE Chinese_PRC_CI_AS NULL,
	[name] [varchar](100) COLLATE Chinese_PRC_CI_AS NULL,
	[mnemonic_code] [varchar](100) COLLATE Chinese_PRC_CI_AS NULL,
	[company_id] [int] NULL
);
--南京
CREATE TABLE [dbo].[t_jiuqi_customer_nj](
	[code] [varchar](100) COLLATE Chinese_PRC_CI_AS NULL,
	[name] [varchar](100) COLLATE Chinese_PRC_CI_AS NULL,
	[mnemonic_code] [varchar](100) COLLATE Chinese_PRC_CI_AS NULL,
	[company_id] [int] NULL
);
--武汉
CREATE TABLE [dbo].[t_jiuqi_customer_wh](
	[code] [varchar](100) COLLATE Chinese_PRC_CI_AS NULL,
	[name] [varchar](100) COLLATE Chinese_PRC_CI_AS NULL,
	[mnemonic_code] [varchar](100) COLLATE Chinese_PRC_CI_AS NULL,
	[company_id] [int] NULL
);
--本部
CREATE TABLE [dbo].[t_jiuqi_customer_bb](
	[code] [varchar](100) COLLATE Chinese_PRC_CI_AS NULL,
	[name] [varchar](100) COLLATE Chinese_PRC_CI_AS NULL,
	[mnemonic_code] [varchar](100) COLLATE Chinese_PRC_CI_AS NULL,
	[company_id] [int] NULL
);
--镇江
CREATE TABLE [dbo].[t_jiuqi_customer_zj](
	[code] [varchar](100) COLLATE Chinese_PRC_CI_AS NULL,
	[name] [varchar](100) COLLATE Chinese_PRC_CI_AS NULL,
	[mnemonic_code] [varchar](100) COLLATE Chinese_PRC_CI_AS NULL,
	[company_id] [int] NULL
);
--重庆
CREATE TABLE [dbo].[t_jiuqi_customer_cq](
	[code] [varchar](100) COLLATE Chinese_PRC_CI_AS NULL,
	[name] [varchar](100) COLLATE Chinese_PRC_CI_AS NULL,
	[mnemonic_code] [varchar](100) COLLATE Chinese_PRC_CI_AS NULL,
	[company_id] [int] NULL
);
--斯迪尔电子
CREATE TABLE [dbo].[t_jiuqi_customer_sdedz](
	[code] [varchar](100) COLLATE Chinese_PRC_CI_AS NULL,
	[name] [varchar](100) COLLATE Chinese_PRC_CI_AS NULL,
	[mnemonic_code] [varchar](100) COLLATE Chinese_PRC_CI_AS NULL,
	[company_id] [int] NULL
);
--斯迪尔钢铁
CREATE TABLE [dbo].[t_jiuqi_customer_sdegt](
	[code] [varchar](100) COLLATE Chinese_PRC_CI_AS NULL,
	[name] [varchar](100) COLLATE Chinese_PRC_CI_AS NULL,
	[mnemonic_code] [varchar](100) COLLATE Chinese_PRC_CI_AS NULL,
	[company_id] [int] NULL
);

--华东物流
update dbo.t_jiuqi_customer_hdwl set company_id=7807;
--朱家桥
update dbo.t_jiuqi_customer_zjq set company_id=6966;
--上海
update dbo.t_jiuqi_customer_sh set company_id=5880;
--仓储
update dbo.t_jiuqi_customer_cc set company_id=7789;
--广州
update dbo.t_jiuqi_customer_gz set company_id=6189;
--杭州
update dbo.t_jiuqi_customer_hz set company_id=5888;
--合肥
update dbo.t_jiuqi_customer_hf set company_id=5881;
--江苏
update dbo.t_jiuqi_customer_js set company_id=6611;
--昆明
update dbo.t_jiuqi_customer_km set company_id=5886;
--联运芜湖
--update dbo.t_jiuqi_customer_lywh set company_id=null;
--联运
update dbo.t_jiuqi_customer_ly set company_id=6528;
--南京
update dbo.t_jiuqi_customer_nj set company_id=5882;
--武汉
update dbo.t_jiuqi_customer_wh set company_id=5885;
--本部
update dbo.t_jiuqi_customer_bb set company_id=6185;
--镇江
update dbo.t_jiuqi_customer_zj set company_id=5883;
--重庆
update dbo.t_jiuqi_customer_cq set company_id=5884;
--斯迪尔电子
--update dbo.t_jiuqi_customer_sdedz set company_id=null;
--斯迪尔钢铁
--update dbo.t_jiuqi_customer_sdegt set company_id=null;


--华东物流
insert into dbo.t_jiuqi_customer(code,name,mnemonic_code,company_id,status)  select code,ltrim(rtrim(name)),mnemonic_code,company_id,'1' from  dbo.t_jiuqi_customer_hdwl;
--朱家桥
insert into dbo.t_jiuqi_customer(code,name,mnemonic_code,company_id,status)  select code,ltrim(rtrim(name)),mnemonic_code,company_id,'1' from  dbo.t_jiuqi_customer_zjq;
--上海
insert into dbo.t_jiuqi_customer(code,name,mnemonic_code,company_id,status)  select code,ltrim(rtrim(name)),mnemonic_code,company_id,'1' from  dbo.t_jiuqi_customer_sh;
--仓储
insert into dbo.t_jiuqi_customer(code,name,mnemonic_code,company_id,status)  select code,ltrim(rtrim(name)),mnemonic_code,company_id,'1' from  dbo.t_jiuqi_customer_cc;
--广州
insert into dbo.t_jiuqi_customer(code,name,mnemonic_code,company_id,status)  select code,ltrim(rtrim(name)),mnemonic_code,company_id,'1' from  dbo.t_jiuqi_customer_gz;
--杭州
insert into dbo.t_jiuqi_customer(code,name,mnemonic_code,company_id,status)  select code,ltrim(rtrim(name)),mnemonic_code,company_id,'1' from  dbo.t_jiuqi_customer_hz;
--合肥
insert into dbo.t_jiuqi_customer(code,name,mnemonic_code,company_id,status)  select code,ltrim(rtrim(name)),mnemonic_code,company_id,'1' from  dbo.t_jiuqi_customer_hf;
--江苏
insert into dbo.t_jiuqi_customer(code,name,mnemonic_code,company_id,status)  select code,ltrim(rtrim(name)),mnemonic_code,company_id,'1' from  dbo.t_jiuqi_customer_js;
--昆明
insert into dbo.t_jiuqi_customer(code,name,mnemonic_code,company_id,status)  select code,ltrim(rtrim(name)),mnemonic_code,company_id,'1' from  dbo.t_jiuqi_customer_km;
--联运芜湖
--insert into dbo.t_jiuqi_customer(code,name,mnemonic_code,company_id,status)  select code,ltrim(rtrim(name)),mnemonic_code,company_id,'1' from dbo.t_jiuqi_customer_lywh;
--联运
insert into dbo.t_jiuqi_customer(code,name,mnemonic_code,company_id,status)  select code,ltrim(rtrim(name)),mnemonic_code,company_id,'1' from  dbo.t_jiuqi_customer_ly;
--南京
insert into dbo.t_jiuqi_customer(code,name,mnemonic_code,company_id,status)  select code,ltrim(rtrim(name)),mnemonic_code,company_id,'1' from  dbo.t_jiuqi_customer_nj;
--武汉
insert into dbo.t_jiuqi_customer(code,name,mnemonic_code,company_id,status)  select code,ltrim(rtrim(name)),mnemonic_code,company_id,'1' from  dbo.t_jiuqi_customer_wh;
--本部
insert into dbo.t_jiuqi_customer(code,name,mnemonic_code,company_id,status)  select code,ltrim(rtrim(name)),mnemonic_code,company_id,'1' from dbo.t_jiuqi_customer_bb;
--镇江
insert into dbo.t_jiuqi_customer(code,name,mnemonic_code,company_id,status)  select code,ltrim(rtrim(name)),mnemonic_code,company_id,'1' from dbo.t_jiuqi_customer_zj;
--重庆
insert into dbo.t_jiuqi_customer(code,name,mnemonic_code,company_id,status)  select code,ltrim(rtrim(name)),mnemonic_code,company_id,'1' from  dbo.t_jiuqi_customer_cq;
--斯迪尔电子
--insert into dbo.t_jiuqi_customer(code,name,mnemonic_code,company_id,status)  select code,ltrim(rtrim(name)),mnemonic_code,company_id,'1' from  dbo.t_jiuqi_customer_sdedz;
--斯迪尔钢铁
--insert into dbo.t_jiuqi_customer(code,name,mnemonic_code,company_id,status)  select code,ltrim(rtrim(name)),mnemonic_code,company_id,'1' from  dbo.t_jiuqi_customer_sdegt;
